import psutil
def get_mac_addresses():
    # 获取所有网络接口的地址信息
    addrs = psutil.net_if_addrs()
    # 尝试获取有线接口的MAC地址
    for interface, addresses in addrs.items():
        for addr in addresses:
            if addr.family == psutil.AF_LINK:
                # 通常有线接口的名称包含 'e', 'en', 'eth' 等
                if 'e' in interface or 'en' in interface or 'eth' in interface or '以太网' == interface:
                    return addr.address

    # 如果没有找到有线接口，尝试获取无线接口的MAC地址
    for interface, addresses in addrs.items():
        for addr in addresses:
            if addr.family == psutil.AF_LINK:
                # 通常无线接口的名称包含 'w', 'wl', 'wlan' 等
                if 'w' in interface or 'wl' in interface or 'wlan' in interface:
                    return addr.address

    # 如果没有找到任何接口的MAC地址，返回空字典
    return None
